/**
 * Metadata API Service
 * 元数据搜索与查询API服务 (FR-010 ~ FR-012)
 */

import { get } from './client'
import type { ApiResponse, PageResponse, MetadataTable, MetadataColumn } from '../models/types'

export const searchTables = async (params: any): Promise<ApiResponse<PageResponse<MetadataTable>>> => {
  return get<PageResponse<MetadataTable>>('/metadata/tables/search', { params })
}

export const getTableDetail = async (id: number): Promise<ApiResponse<MetadataTable>> => {
  return get<MetadataTable>(`/metadata/tables/${id}`)
}

export const getTableColumns = async (tableId: number): Promise<ApiResponse<MetadataColumn[]>> => {
  return get<MetadataColumn[]>(`/metadata/tables/${tableId}/columns`)
}
